import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/material.dart';

class RefreshWidget extends StatelessWidget {
  // final RefreshController controller;
  final EasyRefreshController controller;
  final bool? enablePullDown;
  final bool? enablePullUp;
  final Widget? footer;
  final Widget? header;
  final Function()? onRefresh;
  final Function()? onLoad;
  final Widget child;

  const RefreshWidget({
    super.key,
    required this.controller,
    this.enablePullDown,
    this.enablePullUp,
    this.footer,
    this.header,
    this.onRefresh,
    this.onLoad,
    required this.child,
  });

  @override
  Widget build(BuildContext context) {
    return EasyRefresh(
      // enablePullDown: enablePullDown ?? true,
      // enablePullUp: enablePullUp ?? true,
      // footer: AppConfig.getPublicCustomFooter(_state.bbsList),
      footer: MaterialFooter(),
      header: MaterialHeader(),
      controller: controller,
      onRefresh: onRefresh,
      onLoad: onLoad,
      child: child,
    );
  }
}

// ClassicHeader cHeader = const ClassicHeader(
//   completeText: '刷新成功',
//   refreshingText: '正在刷新',
//   idleText: '下拉刷新',
//   releaseText: '鬆開開始刷新',
//   failedText: '刷新失敗',
// );
//
// ClassicFooter cFooter = const ClassicFooter(
//   loadingText: '加載中…',
//   canLoadingText: '鬆開開始加載',
//   idleText: '上拉加載',
//   noDataText: '沒有更多數據了',
//   failedText: '加載失敗',
// );
